From 534c3d65c5d7cad30b43de3e02402a25679be28f Mon Sep 17 00:00:00 2001 From: weiqiaomiao Date: Wed, 7 Jun 2017 09:39:39 +0100 Subject: [PATCH] rgw: for the create_bucket api, if the input creation_time is zero, we should set it to 'now" Fixes: http://tracker.ceph.com/issues/16597 Signed-off-by: weiqiaomiao Gbp-Pq: Name rgw_rados-creation_time.patch --- src/rgw/rgw_rados.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 3f348502d..539a564a2 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -5153,10 +5153,11 @@ int RGWRados::create_bucket(RGWUserInfo& owner, rgw_bucket& bucket, info.num_shards = bucket_index_max_shards; info.bucket_index_shard_hash_type = RGWBucketInfo::MOD; info.requester_pays = false; - if (real_clock::is_zero(creation_time)) - creation_time = ceph::real_clock::now(cct); - else + if (real_clock::is_zero(creation_time)) { + info.creation_time = ceph::real_clock::now(cct); + } else { info.creation_time = creation_time; + } ret = put_linked_bucket_info(info, exclusive, ceph::real_time(), pep_objv, &attrs, true); if (ret == -EEXIST) { /* we need to reread the info and return it, caller will have a use for it */ -- 2.30.2